#include "radiation_source_state_machine/state_machine_node.hpp"
#include <rclcpp/rclcpp.hpp>
#include <memory>

int main(int argc, char* argv[])
{
    rclcpp::init(argc, argv);
    
    RCLCPP_INFO(rclcpp::get_logger("main"), "Starting Radiation Source State Machine");
    
    auto options = rclcpp::NodeOptions().use_intra_process_comms(true);
    auto state_machine_node = std::make_shared<radiation_source_state_machine::StateMachineNode>(options);
    
    // Start the state machine
    state_machine_node->startStateMachine();
    
    // Use multi-threaded executor for better concurrency
    rclcpp::executors::MultiThreadedExecutor executor;
    executor.add_node(state_machine_node);
    
    // Spin until shutdown
    executor.spin();
    
    rclcpp::shutdown();
    
    RCLCPP_INFO(rclcpp::get_logger("main"), "Radiation Source State Machine shutdown complete");
    
    return 0;
}